package com.example.cyh.bczapp.Code.BLL;

import com.example.cyh.bczapp.Code.Helper.HttpHelper;
import com.example.cyh.bczapp.Code.Model.RemenberInfEntity;
import com.example.cyh.bczapp.Code.Model.WordGroupInfEntity;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.List;

/**
 * Created by cyh on 2017/5/23.
 */

public class WordGroupBLL {
    private final String BaseUrl="http://123.207.86.30/public/index.php/db/";
    public WordGroupInfEntity getWordGroup(String id)
    {
        String url=BaseUrl+"/Wordgroupcontrol/IdFindRecord";
        Dictionary<String, String> param = new Hashtable();
        param.put("Id",id);
        try {
            String  back= HttpHelper.POST(url,param);
            Gson gson=new Gson();
            return gson.fromJson(back,WordGroupInfEntity.class);
        }
        catch (Exception ex)
        {
            return null;
        }
    }
    public List<WordGroupInfEntity> GetAllwgName()
    {
        Gson gson=new Gson();
        String url=BaseUrl+"/Wordgroupcontrol/Getallname";
        try {
            Type type=new TypeToken<ArrayList<WordGroupInfEntity>>(){}.getType();
            String  back= HttpHelper.POST(url,null);
            return gson.fromJson(back,type);
        }
        catch (Exception ex)
        {
            return null;
        }
    }

}
